/**
 * @Description: 请求拦截器
 * @author zhaojiuyi
 * @date 2023/4/16
 */
import {InternalAxiosRequestConfig} from "axios";
import store from "@/redux/store";

export const requestInterceptor = (config: InternalAxiosRequestConfig):InternalAxiosRequestConfig => {
    const {user:{token}} = store.getState()
    if (token){
        config.headers.set("Authorization",`Bearer ${token}`)
    }
    return config
}
